home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
news
/
inn-1.4-l
/
inn-1
/
inn-1.4-linux-0.1
/
inn-patches
/
inn-1.4-ctlinnd-patch
Wrap
Internet Message Format
|
1993-08-15
|
5KB
From adv.win.tue.nl!svin09.info.win.tue.nl!tuegate.tue.nl!sun4nl!mcsun!uunet!charon.citicorp.com!charon.citicorp.com!not-for-mail Sun Aug 15 20:18:37 GMT 1993
Article: 1541 of news.software.nntp
Path: adv.win.tue.nl!svin09.info.win.tue.nl!tuegate.tue.nl!sun4nl!mcsun!uunet!charon.citicorp.com!charon.citicorp.com!not-for-mail
From: philip@charon.citicorp.com (Philip Gladstone)
Newsgroups: news.software.nntp
Subject: Patch to fix ctlinnd hang if no Unix Domain Sockets
Date: 14 Aug 1993 15:26:32 -0400
Organization: Citicorp
Lines: 141
Distribution: inet
Message-ID: <24je98$anr@charon.citicorp.com>
Reply-To: Philip.Gladstone@mail.citicorp.com
NNTP-Posting-Host: charon.citicorp.com
X-Newsreader: TIN [version 1.2 PL1]
The following is a patch to fix the problem of multiple ctlinnd
processes interfering with each other. This problem arises on
system which do not use Unix Domain Sockets. The problem normally
arises when a bunch of 'newgroup' messages come out at the same
time. Only the first one works -- all the rest fail.
Philip.
*** lib/inndcomm.c.orig Fri Aug 13 13:44:24 1993
--- lib/inndcomm.c Sat Aug 14 15:12:54 1993
***************
*** 169,175 ****
--- 169,186 ----
/*
** Send an arbitrary command to the server.
+ ** Note that for those systems without Unix Domain Sockets,
+ ** the command format is different. There is a two byte
+ ** length code on the front of the message. This is a
+ ** direct mapped integer. Note that sending and receiving
+ ** architectures *must* be the same as we are on the same
+ ** machine.
*/
+ #if defined(DO_HAVE_UNIX_DOMAIN)
+ #define BUFF_OFFSET 0
+ #else
+ #define BUFF_OFFSET sizeof(ICC_MSGLENTYPE)
+ #endif
int
ICCcommand(cmd, argv, replyp)
char cmd;
***************
*** 203,209 ****
bufsiz += 1 + strlen(p);
if (bufsiz < MIN_BUFFER_SIZE)
bufsiz = MIN_BUFFER_SIZE;
! buff = malloc((unsigned int)bufsiz);
if (buff == NULL) {
ICCfailure = "malloc";
return -1;
--- 214,220 ----
bufsiz += 1 + strlen(p);
if (bufsiz < MIN_BUFFER_SIZE)
bufsiz = MIN_BUFFER_SIZE;
! buff = malloc((unsigned int)bufsiz + BUFF_OFFSET);
if (buff == NULL) {
ICCfailure = "malloc";
return -1;
***************
*** 211,216 ****
--- 222,229 ----
if (replyp)
*replyp = NULL;
+ buff += BUFF_OFFSET; /* Advance to leave space for length */
+
/* Format the message. */
(void)sprintf(buff, "%s%c%c", ICCsockname, SC_SEP, cmd);
for (p = buff + strlen(buff), i = 0; (q = argv[i]) != NULL; i++) {
***************
*** 221,226 ****
--- 234,243 ----
/* Send message. */
ICCfailure = NULL;
len = p - buff;
+
+ buff -= BUFF_OFFSET; /* Not strictly required - could be inside
+ * #else clause below */
+
#if defined(DO_HAVE_UNIX_DOMAIN)
if (sendto(ICCfd, buff, len, 0,
(struct sockaddr *)&ICCserv, AF_UNIX_SOCKSIZE(ICCserv)) < 0) {
***************
*** 234,239 ****
--- 251,258 ----
ICCfailure = "open";
return -1;
}
+ *(ICC_MSGLENTYPE *) buff = len;
+ len += BUFF_OFFSET;
if (write(fd, buff, len) != len) {
i = errno;
DISPOSE(buff);
*** include/inndcomm.h.orig Sat Aug 14 15:09:12 1993
--- include/inndcomm.h Sat Aug 14 15:14:44 1993
***************
*** 4,9 ****
--- 4,15 ----
** running.
*/
+ #if !defined(DO_HAVE_UNIX_DOMAIN)
+ typedef short ICC_MSGLENTYPE; /* Length code to prefix commands to
+ ** the server.
+ */
+ #endif
+
#define SC_SEP '\001'
#define SC_MAXFIELDS 6
*** innd/cc.c.orig Fri Aug 13 13:51:22 1993
--- innd/cc.c Sat Aug 14 15:13:52 1993
***************
*** 1314,1319 ****
--- 1314,1320 ----
struct sockaddr_un client;
#else
int written;
+ ICC_MSGLENTYPE bufflen;
#endif /* defined(DO_HAVE_UNIX_DOMAIN) */
int i;
char buff[BUFSIZ + 2];
***************
*** 1329,1335 ****
--- 1330,1350 ----
}
/* Get the message. */
+ #if !defined(DO_HAVE_UNIX_DOMAIN)
+ i = RECVorREAD(CCchan->fd, (char *) &bufflen, sizeof(bufflen));
+ if (i != sizeof(bufflen)
+ || bufflen < 1 || bufflen >= (sizeof buff - 1)) {
+ syslog(L_ERROR, "%s cant recv CCreader length %m", LogName);
+ return;
+ }
+ i = RECVorREAD(CCchan->fd, buff, bufflen);
+ if (i > 0 && i != bufflen) {
+ syslog(L_ERROR, "%s cant recv CCreader data %m", LogName);
+ return;
+ }
+ #else
i = RECVorREAD(CCchan->fd, buff, sizeof buff - 1);
+ #endif
if (i < 0) {
syslog(L_ERROR, "%s cant recv CCreader %m", LogName);
return;
--
Philip Gladstone - Consultant
Citicorp Global Information Network
I don't speak for Citicorp. I presume that somebody else does!